asm
  ld sp,$8FFF
  end asm

#include "./library/pacmandelay.bas"
#include "./library/smsrnd.bas"

dim eee as uinteger at $8010
dim seed as uinteger at $8012
dim ee0 as uinteger at $8014
dim ee1 as uinteger at $8016
dim ee2 as uinteger at $8018
dim ee3 as uinteger at $801A
dim eex as uinteger at $801C
dim eey as uinteger at $801E

sub pipelineputchar(txp1 as uinteger, typ1 as uinteger, tch1 as ubyte, tat1 as ubyte):
  poke $8800+(typ1*64)+txp1,tch1
  poke $9000+(typ1*64)+txp1,tat1
  end sub

seed=0

for ee0=2 to 29
  for ee1=0 to 39
    pipelineputchar(ee1,ee0,1,1)
    next:next

for ee0=2 to 29
  for ee1=0 to 39
    seed=smsrnd(seed)
    ee2=seed
    seed=smsrnd(seed)
    pipelineputchar(ee1,ee0,(seed mod 7)+1,ee2 band 15)
    next:next

for ee0=0 to 15
  for ee1=0 to 15
    pipelineputchar(ee1+23,ee0+13,(ee0*16)+ee1,0)
    next:next



eee=0:eex=8:eey=8
do

pipelineputchar(1,3,48+((int(eee/100)) mod 10),0)
pipelineputchar(2,3,48+((int(eee/10)) mod 10),0)
pipelineputchar(3,3,48+(eee mod 10),0)

ee0=peek($B800) bxor $FF
pipelineputchar(1,5,48+((int(ee0/100)) mod 10),0)
pipelineputchar(2,5,48+((int(ee0/10)) mod 10),0)
pipelineputchar(3,5,48+(ee0 mod 10),0)

eey=eey-((ee0 band 1)/1)+((ee0 band 2)/2)
eex=eex-((ee0 band 4)/4)+((ee0 band 8)/8)

pipelineputchar(eex,eey,eee band 63,0)


pacmandelay(1000)
eee=eee+1
loop





do:loop

'----------------------------------------



do

for eee=0 to $7FF
  seed=smsrnd(seed)
  poke $8800+eee,seed mod 128 '- 1/1 chr
  seed=smsrnd(seed)
  poke $9000+eee,seed band 15 '- 1/1 attr
  pacmandelay(1000)
  next


loop


do:loop



do

for eee=$8800 to $A7FF
  seed=smsrnd(seed)
  poke eee,seed
  'pacmandelay(1000)
  next

loop

do:loop





for eee=0 to 255
  seed=smsrnd(seed):poke $9800+eee,seed '- r
  seed=smsrnd(seed):poke $9900+eee,seed '- g
  seed=smsrnd(seed):poke $9A00+eee,seed '- b
  pacmandelay(1000)
  next





do:loop


for eee=0 to $7FF
  seed=smsrnd(seed)
  poke $8800+eee,seed '- 1/1 chr
  seed=smsrnd(seed)
  poke $9000+eee,seed '- 1/1 attr
  pacmandelay(1000)
  next








for eee=$8800 to $8FFF '- 1/1 chr
  seed=smsrnd(seed)
  poke eee,seed
  pacmandelay(1000)
  next

'- attr
for eee=$9000 to $97FF '- 1/1 attr
  seed=smsrnd(seed)
  poke eee,seed
  pacmandelay(1000)
  next

















for eee=$9C00 to $9FFF
  seed=smsrnd(seed)
  poke eee,seed
  pacmandelay(1000)
  next

do:loop

for eee=$9B00 to $9BFF
  seed=smsrnd(seed)
  poke eee,seed
  pacmandelay(1000)
  next


for eee=$A000 to $A7FF
  seed=smsrnd(seed)
  poke eee,seed
  pacmandelay(1000)
  next






for eee=$9C00 to $9FFF
  poke eee,0
  next


for eee=$9B00 to $9BFF '- b - 0..255
  seed=smsrnd(seed)
  poke eee,seed
  pacmandelay(1000)
  next




do

for eee=$9800 to $9FFF
  seed=smsrnd(seed)
  poke eee,seed
  pacmandelay(1000)
  next



for eee=$8800 to $8FFF
  seed=smsrnd(seed)
  poke eee,seed
  pacmandelay(1000)
  next




for eee=$9A00 to $9AFF '- b - 0..255
  seed=smsrnd(seed)
  poke eee,seed
  pacmandelay(1000)
  next

for eee=$9900 to $99FF '- g - 0..255
  seed=smsrnd(seed)
  poke eee,seed
  pacmandelay(1000)
  next

for eee=$9800 to $98FF '- r - 0..255
  seed=smsrnd(seed)
  poke eee,seed
  pacmandelay(1000)
  next

loop




'- static ADDRESS_MAP_START( cpu0_mem, AS_PROGRAM, 8, pipeline_state )
'- AM_RANGE(0x0000, 0x7fff) AM_ROM
'- AM_RANGE(0x8000, 0x87ff) AM_RAM
'- AM_RANGE(0x8800, 0x97ff) AM_RAM_WRITE(vram1_w) AM_SHARE("vram1")
'- AM_RANGE(0x9800, 0xa7ff) AM_RAM_WRITE(vram2_w) AM_SHARE("vram2")
'- AM_RANGE(0xb800, 0xb803) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write)
'- AM_RANGE(0xb810, 0xb813) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write)
'- AM_RANGE(0xb830, 0xb830) AM_NOP
'- AM_RANGE(0xb840, 0xb840) AM_NOP
'- ADDRESS_MAP_END




